package com.example.utils;

import com.example.utils.image.HttpUtils;

import java.io.InputStream;

/**机器人工具类
 * @author LEI
 * Created by LEI on 2020/3/30.
 */
public class MachineUtils {

    private static final String url = "http://i.itpk.cn/api.php?question=";

    public static String getMachineMsg(String msg){
        if(StringUtils.isEmpty(msg))return null;
        try {
            InputStream inputStream = HttpUtils.getInputStreamByGet(url+msg);
            byte[] bytes;
            if(inputStream != null){
                bytes = new byte[inputStream.available()];
                inputStream.read(bytes);
                return new String(bytes);
            }
            return null;
        }catch (Exception e){
            MyLog.log(e.getMessage());
            return null;
        }
    }
}
